/*
* Copyright 2018 Shanxi Lu'an Taihang Laihui Net Tech co.,LTD.
*/
package com.laihuichuxing.observer;/**
 * Description:
 *
 * @author: Qinxuefeng
 * @since: 1.0
 * Create Date Time: 2018/12/27 11:23
 * Update Date Time:
 */

public class Main {
    public static void main(String[] args) {
        ConcreteSubject concreteSubject = new ConcreteSubject();
        ConcreteObserver z = new ConcreteObserver(concreteSubject, "Z");
        concreteSubject.attach(new ConcreteObserver(concreteSubject, "X"));
        concreteSubject.attach(new ConcreteObserver(concreteSubject, "Y"));
        concreteSubject.attach(z);
        concreteSubject.detach(z);

        concreteSubject.setSubjectState("ABC");
        concreteSubject.notifyObserver();
    }
}
